<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>
        后台管理系统
    </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="static/css/x-admin.css" media="all">

    <style>
        .imgs {
            display: none;
        }
    </style>
    <!--百度编辑器-->

</head>
<body>
<div class="x-nav">
            <span class="layui-breadcrumb">
              <a><cite>首页</cite></a>
              <a><cite>栏目管理</cite></a>
              <a><cite>基本设置</cite></a>
            </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon"
                                                                          style="line-height:30px">ဂ</i></a>
</div>

<form class="layui-form layui-form-pane" id="add" enctype="multipart/form-data">
    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
        <ul class="layui-tab-title">
            <li class="layui-this">基本信息</li>
        </ul>
        <div class="layui-form-item">
            <label class="layui-form-label">id</label>
            <div class="layui-input-block">
                <input type="text" name="id" required lay-verify="required" autocomplete="off"
                       class="layui-input" value="{{ id }}" readonly>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">标题</label>
            <div class="layui-input-block">
                <input type="text" name="title" required lay-verify="required" autocomplete="off"
                       class="layui-input" value="{{ title }}">
            </div>
        </div>   <div class="layui-form-item">
            <label class="layui-form-label">发布时间</label>
            <div class="layui-input-block">
                <input type="text" name="datetime" required lay-verify="required" autocomplete="off"
                       class="layui-input" value="{{ datetime }}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">图片地址</label>
            <div class="layui-input-block">
                <input type="text" name="imgurl" required lay-verify="required" autocomplete="off"
                       class="layui-input" value="{{ imgurl }}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">文本1</label>
            <div class="layui-input-block">
                <input type="text" name="text1" required lay-verify="required" autocomplete="off"
                       class="layui-input" value="{{ text1 }}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">文本2</label>
            <div class="layui-input-block">
                <input type="text" name="text2" required lay-verify="required" autocomplete="off"
                       class="layui-input" value="{{ text2 }}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">文本3</label>
            <div class="layui-input-block">
                <input type="text" name="text3" required lay-verify="required" autocomplete="off"
                       class="layui-input" value="{{ text3 }}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">文本4</label>
            <div class="layui-input-block">
                <input type="text" name="text4" required lay-verify="required" autocomplete="off"
                       class="layui-input" value="{{ text4 }}">
            </div>
        </div>


        <div class="layui-form-item">
            <div>
                <button class="layui-btn" id="submitBtn">立即提交</button>
            </div>
        </div>

</form>


</body>
<script src="static/lib/layui/layui.js" charset="utf-8"></script>
<script src="static/js/x-layui.js" charset="utf-8"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script type="text/javascript">
    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    {#UE.getEditor('content', {initialFrameWidth: 600, initialFrameHeight: 400,});#}
</script>

<!--栏目缩略图上传-->
<script>
    $(document).ready(function () {
        // 监听表单提交按钮的点击事件
        $("#submitBtn").click(function (event) {
            // 阻止表单默认的提交行为
            console.log('12312312321')
            event.preventDefault();
            // 使用Ajax提交表单数据
            $.ajax({
                url: "/news_do_update",  // 后端处理URL
                method: "POST",       // 使用POST方法提交
                data: $("#add").serialize(),  // 使用serialize()方法将表单数据序列化
                success: function (response) {
                    // 请求成功时的处理逻辑
                    alert("修改成功");
                    parent.layer.close(parent.layer.getFrameIndex(window.name));
                    parent.location.reload();

                },
                error: function (xhr, status, error) {
                    // 请求失败时的处理逻辑
                    alert("修改失败");
                }
            });
        });
    });

</script>


</html>